home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / docs / gas / as.i1 < prev    next >
Encoding:
GNU Info File  |  1994-12-17  |  49.1 KB  |  1,343 lines

  1. This is Info file as.info, produced by Makeinfo-1.55 from the input
  2. file ./as.texinfo.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * As: (as).                     The GNU assembler.
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This file documents the GNU Assembler "as".
  9.  
  10.    Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
  11.  
  12.    Permission is granted to make and distribute verbatim copies of this
  13. manual provided the copyright notice and this permission notice are
  14. preserved on all copies.
  15.  
  16.    Permission is granted to copy and distribute modified versions of
  17. this manual under the conditions for verbatim copying, provided that
  18. the entire resulting derived work is distributed under the terms of a
  19. permission notice identical to this one.
  20.  
  21.    Permission is granted to copy and distribute translations of this
  22. manual into another language, under the above conditions for modified
  23. versions.
  24.  
  25. 
  26. File: as.info,  Node: Top,  Next: Overview,  Prev: (DIR),  Up: (DIR)
  27.  
  28. Using as
  29. ********
  30.  
  31.    This file is a user guide to the GNU assembler `as'.
  32.  
  33. * Menu:
  34.  
  35. * Overview::                    Overview
  36. * Invoking::                    Command-Line Options
  37. * Syntax::                      Syntax
  38. * Sections::                    Sections and Relocation
  39. * Symbols::                     Symbols
  40. * Expressions::                 Expressions
  41. * Pseudo Ops::                  Assembler Directives
  42. * Machine Dependencies::        Machine Dependent Features
  43. * Acknowledgements::            Who Did What
  44. * Index::                       Index
  45.  
  46. 
  47. File: as.info,  Node: Overview,  Next: Invoking,  Prev: Top,  Up: Top
  48.  
  49. Overview
  50. ********
  51.  
  52.    Here is a brief summary of how to invoke `as'.  For details, *note
  53. Comand-Line Options: Invoking..
  54.  
  55.      as [ -a[dhlns] ] [ -D ] [ -f ] [ --help ]
  56.       [ -I DIR ] [ -J ] [ -K ] [ -L ] [ -o OBJFILE ]
  57.       [ -R ] [ --statistics ] [ -v ] [ -version ] [ --version ]
  58.       [ -W ] [ -w ] [ -x ] [ -Z ]
  59.       [ -Av6 | -Av7 | -Av8 | -Asparclite | -bump ]
  60.       [ -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC ]
  61.       [ -b ] [ -no-relax ]
  62.       [ -l ] [ -m68000 | -m68010 | -m68020 | ... ]
  63.       [ -nocpp ] [ -EL ] [ -EB ] [ -G NUM ]
  64.       [ -mips1 ] [ -mips2 ] [ -mips3 ]
  65.       [ --trap ] [ --break ]
  66.       [ -- | FILES ... ]
  67.  
  68. `-a[dhlns]'
  69.      Turn on listings, in any of a variety of ways:
  70.  
  71.     `-ad'
  72.           omit debugging directives
  73.  
  74.     `-ah'
  75.           include high-level source
  76.  
  77.     `-al'
  78.           include assembly
  79.  
  80.     `-an'
  81.           omit forms processing
  82.  
  83.     `-as'
  84.           include symbols
  85.  
  86.      You may combine these options; for example, use `-aln' for assembly
  87.      listing without forms processing.  By itself, `-a' defaults to
  88.      `-ahls'--that is, all listings turned on.
  89.  
  90. `-D'
  91.      Ignored.  This option is accepted for script compatibility with
  92.      calls to other assemblers.
  93.  
  94. `-f'
  95.      "fast"--skip whitespace and comment preprocessing (assume source is
  96.      compiler output).
  97.  
  98. `--help'
  99.      Print a summary of the command line options and exit.
  100.  
  101. `-I DIR'
  102.      Add directory DIR to the search list for `.include' directives.
  103.  
  104. `-J'
  105.      Don't warn about signed overflow.
  106.  
  107. `-K'
  108.      Issue warnings when difference tables altered for long
  109.      displacements.
  110.  
  111. `-L'
  112.      Keep (in the symbol table) local symbols, starting with `L'.
  113.  
  114. `-o OBJFILE'
  115.      Name the object-file output from `as' OBJFILE.
  116.  
  117. `-R'
  118.      Fold the data section into the text section.
  119.  
  120. `--statistics'
  121.      Print the maximum space (in bytes) and total time (in seconds)
  122.      used by assembly.
  123.  
  124. `-v'
  125. `-version'
  126.      Print the `as' version.
  127.  
  128. `--version'
  129.      Print the `as' version and exit.
  130.  
  131. `-W'
  132.      Suppress warning messages.
  133.  
  134. `-w'
  135.      Ignored.
  136.  
  137. `-x'
  138.      Ignored.
  139.  
  140. `-Z'
  141.      Generate an object file even after errors.
  142.  
  143. `-- | FILES ...'
  144.      Standard input, or source files to assemble.
  145.  
  146.    The following options are available when as is configured for the
  147. Intel 80960 processor.
  148.  
  149. `-ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC'
  150.      Specify which variant of the 960 architecture is the target.
  151.  
  152. `-b'
  153.      Add code to collect statistics about branches taken.
  154.  
  155. `-no-relax'
  156.      Do not alter compare-and-branch instructions for long
  157.      displacements; error if necessary.
  158.  
  159.    The following options are available when as is configured for the
  160. Motorola 68000 series.
  161.  
  162. `-l'
  163.      Shorten references to undefined symbols, to one word instead of
  164.      two.
  165.  
  166. `-m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040'
  167. `| -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -mcpu32'
  168.      Specify what processor in the 68000 family is the target.  The
  169.      default is normally the 68020, but this can be changed at
  170.      configuration time.
  171.  
  172. `-m68881 | -m68882 | -mno-68881 | -mno-68882'
  173.      The target machine does (or does not) have a floating-point
  174.      coprocessor.  The default is to assume a coprocessor for 68020,
  175.      68030, and cpu32.  Although the basic 68000 is not compatible with
  176.      the 68881, a combination of the two can be specified, since it's
  177.      possible to do emulation of the coprocessor instructions with the
  178.      main processor.
  179.  
  180. `-m68851 | -mno-68851'
  181.      The target machine does (or does not) have a memory-management
  182.      unit coprocessor.  The default is to assume an MMU for 68020 and
  183.      up.
  184.  
  185.    The following options are available when `as' is configured for the
  186. SPARC architecture:
  187.  
  188. `-Av6 | -Av7 | -Av8 | -Asparclite'
  189.      Explicitly select a variant of the SPARC architecture.
  190.  
  191. `-bump'
  192.      Warn when the assembler switches to another architecture.
  193.  
  194.    The following options are available when as is configured for a MIPS
  195. processor.
  196.  
  197. `-G NUM'
  198.      This option sets the largest size of an object that can be
  199.      referenced implicitly with the `gp' register.  It is only accepted
  200.      for targets that use ECOFF format, such as a DECstation running
  201.      Ultrix.  The default value is 8.
  202.  
  203. `-EB'
  204.      Generate "big endian" format output.
  205.  
  206. `-EL'
  207.      Generate "little endian" format output.
  208.  
  209. `-mips1'
  210. `-mips2'
  211. `-mips3'
  212.      Generate code for a particular MIPS Instruction Set Architecture
  213.      level.  `-mips1' corresponds to the R2000 and R3000 processors,
  214.      `-mips2' to the R6000 processor, and `-mips3' to the R4000
  215.      processor.
  216.  
  217. `-nocpp'
  218.      `as' ignores this option.  It is accepted for compatibility with
  219.      the native tools.
  220.  
  221. `--trap'
  222. `--no-trap'
  223. `--break'
  224. `--no-break'
  225.      Control how to deal with multiplication overflow and division by
  226.      zero.  `--trap' or `--no-break' (which are synonyms) take a trap
  227.      exception (and only work for Instruction Set Architecture level 2
  228.      and higher); `--break' or `--no-trap' (also synonyms, and the
  229.      default) take a break exception.
  230.  
  231. * Menu:
  232.  
  233. * Manual::                      Structure of this Manual
  234. * GNU Assembler::               as, the GNU Assembler
  235. * Object Formats::              Object File Formats
  236. * Command Line::                Command Line
  237. * Input Files::                 Input Files
  238. * Object::                      Output (Object) File
  239. * Errors::                      Error and Warning Messages
  240.  
  241. 
  242. File: as.info,  Node: Manual,  Next: GNU Assembler,  Up: Overview
  243.  
  244. Structure of this Manual
  245. ========================
  246.  
  247.    This manual is intended to describe what you need to know to use GNU
  248. `as'.  We cover the syntax expected in source files, including notation
  249. for symbols, constants, and expressions; the directives that `as'
  250. understands; and of course how to invoke `as'.
  251.  
  252.    This manual also describes some of the machine-dependent features of
  253. various flavors of the assembler.
  254.  
  255.    On the other hand, this manual is *not* intended as an introduction
  256. to programming in assembly language--let alone programming in general!
  257. In a similar vein, we make no attempt to introduce the machine
  258. architecture; we do *not* describe the instruction set, standard
  259. mnemonics, registers or addressing modes that are standard to a
  260. particular architecture.  You may want to consult the manufacturer's
  261. machine architecture manual for this information.
  262.  
  263. 
  264. File: as.info,  Node: GNU Assembler,  Next: Object Formats,  Prev: Manual,  Up: Overview
  265.  
  266. as, the GNU Assembler
  267. =====================
  268.  
  269.    GNU `as' is really a family of assemblers.  If you use (or have
  270. used) the GNU assembler on one architecture, you should find a fairly
  271. similar environment when you use it on another architecture.  Each
  272. version has much in common with the others, including object file
  273. formats, most assembler directives (often called "pseudo-ops") and
  274. assembler syntax.
  275.  
  276.    `as' is primarily intended to assemble the output of the GNU C
  277. compiler `gcc' for use by the linker `ld'.  Nevertheless, we've tried
  278. to make `as' assemble correctly everything that other assemblers for
  279. the same machine would assemble.  Any exceptions are documented
  280. explicitly (*note Machine Dependencies::.).  This doesn't mean `as'
  281. always uses the same syntax as another assembler for the same
  282. architecture; for example, we know of several incompatible versions of
  283. 680x0 assembly language syntax.
  284.  
  285.    Unlike older assemblers, `as' is designed to assemble a source
  286. program in one pass of the source file.  This has a subtle impact on the
  287. `.org' directive (*note `.org': Org.).
  288.  
  289. 
  290. File: as.info,  Node: Object Formats,  Next: Command Line,  Prev: GNU Assembler,  Up: Overview
  291.  
  292. Object File Formats
  293. ===================
  294.  
  295.    The GNU assembler can be configured to produce several alternative
  296. object file formats.  For the most part, this does not affect how you
  297. write assembly language programs; but directives for debugging symbols
  298. are typically different in different file formats.  *Note Symbol
  299. Attributes: Symbol Attributes.
  300.  
  301. 
  302. File: as.info,  Node: Command Line,  Next: Input Files,  Prev: Object Formats,  Up: Overview
  303.  
  304. Command Line
  305. ============
  306.  
  307.    After the program name `as', the command line may contain options
  308. and file names.  Options may appear in any order, and may be before,
  309. after, or between file names.  The order of file names is significant.
  310.  
  311.    `--' (two hyphens) by itself names the standard input file
  312. explicitly, as one of the files for `as' to assemble.
  313.  
  314.    Except for `--' any command line argument that begins with a hyphen
  315. (`-') is an option.  Each option changes the behavior of `as'.  No
  316. option changes the way another option works.  An option is a `-'
  317. followed by one or more letters; the case of the letter is important.
  318. All options are optional.
  319.  
  320.    Some options expect exactly one file name to follow them.  The file
  321. name may either immediately follow the option's letter (compatible with
  322. older assemblers) or it may be the next command argument (GNU
  323. standard).  These two command lines are equivalent:
  324.  
  325.      as -o my-object-file.o mumble.s
  326.      as -omy-object-file.o mumble.s
  327.  
  328. 
  329. File: as.info,  Node: Input Files,  Next: Object,  Prev: Command Line,  Up: Overview
  330.  
  331. Input Files
  332. ===========
  333.  
  334.    We use the phrase "source program", abbreviated "source", to
  335. describe the program input to one run of `as'.  The program may be in
  336. one or more files; how the source is partitioned into files doesn't
  337. change the meaning of the source.
  338.  
  339.    The source program is a concatenation of the text in all the files,
  340. in the order specified.
  341.  
  342.    Each time you run `as' it assembles exactly one source program.  The
  343. source program is made up of one or more files.  (The standard input is
  344. also a file.)
  345.  
  346.    You give `as' a command line that has zero or more input file names.
  347. The input files are read (from left file name to right).  A command
  348. line argument (in any position) that has no special meaning is taken to
  349. be an input file name.
  350.  
  351.    If you give `as' no file names it attempts to read one input file
  352. from the `as' standard input, which is normally your terminal.  You may
  353. have to type ctl-D to tell `as' there is no more program to assemble.
  354.  
  355.    Use `--' if you need to explicitly name the standard input file in
  356. your command line.
  357.  
  358.    If the source is empty, `as' produces a small, empty object file.
  359.  
  360. Filenames and Line-numbers
  361. --------------------------
  362.  
  363.    There are two ways of locating a line in the input file (or files)
  364. and either may be used in reporting error messages.  One way refers to
  365. a line number in a physical file; the other refers to a line number in a
  366. "logical" file.  *Note Error and Warning Messages: Errors.
  367.  
  368.    "Physical files" are those files named in the command line given to
  369. `as'.
  370.  
  371.    "Logical files" are simply names declared explicitly by assembler
  372. directives; they bear no relation to physical files.  Logical file names
  373. help error messages reflect the original source file, when `as' source
  374. is itself synthesized from other files.  *Note `.app-file': App-File.
  375.  
  376. 
  377. File: as.info,  Node: Object,  Next: Errors,  Prev: Input Files,  Up: Overview
  378.  
  379. Output (Object) File
  380. ====================
  381.  
  382.    Every time you run `as' it produces an output file, which is your
  383. assembly language program translated into numbers.  This file is the
  384. object file.  Its default name is `a.out', or `b.out' when `as' is
  385. configured for the Intel 80960.  You can give it another name by using
  386. the `-o' option.  Conventionally, object file names end with `.o'.  The
  387. default name is used for historical reasons: older assemblers were
  388. capable of assembling self-contained programs directly into a runnable
  389. program.  (For some formats, this isn't currently possible, but it can
  390. be done for the `a.out' format.)
  391.  
  392.    The object file is meant for input to the linker `ld'.  It contains
  393. assembled program code, information to help `ld' integrate the
  394. assembled program into a runnable file, and (optionally) symbolic
  395. information for the debugger.
  396.  
  397. 
  398. File: as.info,  Node: Errors,  Prev: Object,  Up: Overview
  399.  
  400. Error and Warning Messages
  401. ==========================
  402.  
  403.    `as' may write warnings and error messages to the standard error
  404. file (usually your terminal).  This should not happen when  a compiler
  405. runs `as' automatically.  Warnings report an assumption made so that
  406. `as' could keep assembling a flawed program; errors report a grave
  407. problem that stops the assembly.
  408.  
  409.    Warning messages have the format
  410.  
  411.      file_name:NNN:Warning Message Text
  412.  
  413. (where NNN is a line number).  If a logical file name has been given
  414. (*note `.app-file': App-File.) it is used for the filename, otherwise
  415. the name of the current input file is used.  If a logical line number
  416. was given (*note `.line': Line.) then it is used to calculate the
  417. number printed, otherwise the actual line in the current source file is
  418. printed.  The message text is intended to be self explanatory (in the
  419. grand Unix tradition).
  420.  
  421.    Error messages have the format
  422.      file_name:NNN:FATAL:Error Message Text
  423.    The file name and line number are derived as for warning messages.
  424. The actual message text may be rather less explanatory because many of
  425. them aren't supposed to happen.
  426.  
  427. 
  428. File: as.info,  Node: Invoking,  Next: Syntax,  Prev: Overview,  Up: Top
  429.  
  430. Command-Line Options
  431. ********************
  432.  
  433.    This chapter describes command-line options available in *all*
  434. versions of the GNU assembler; *note Machine Dependencies::., for
  435. options specific to particular machine architectures.
  436.  
  437.    If you are invoking `as' via the GNU C compiler (version 2), you can
  438. use the `-Wa' option to pass arguments through to the assembler.  The
  439. assembler arguments must be separated from each other (and the `-Wa')
  440. by commas.  For example:
  441.  
  442.      gcc -c -g -O -Wa,-alh,-L file.c
  443.  
  444. emits a listing to standard output with high-level and assembly source.
  445.  
  446.    Usually you do not need to use this `-Wa' mechanism, since many
  447. compiler command-line options are automatically passed to the assembler
  448. by the compiler.  (You can call the GNU compiler driver with the `-v'
  449. option to see precisely what options it passes to each compilation
  450. pass, including the assembler.)
  451.  
  452. * Menu:
  453.  
  454. * a::             -a[dhlns] enable listings
  455. * D::             -D for compatibility
  456. * f::             -f to work faster
  457. * I::             -I for .include search path
  458.  
  459. * K::             -K for difference tables
  460.  
  461. * L::             -L to retain local labels
  462. * o::             -o to name the object file
  463. * R::             -R to join data and text sections
  464. * statistics::    -statistics to see statistics about assembly
  465. * v::             -v to announce version
  466. * W::             -W to suppress warnings
  467. * Z::             -Z to make object file even after errors
  468.  
  469. 
  470. File: as.info,  Node: a,  Next: D,  Up: Invoking
  471.  
  472. Enable Listings: `-a[dhlns]'
  473. ============================
  474.  
  475.    These options enable listing output from the assembler.  By itself,
  476. `-a' requests high-level, assembly, and symbols listing.  You can use
  477. other letters to select specific options for the list: `-ah' requests a
  478. high-level language listing, `-al' requests an output-program assembly
  479. listing, and `-as' requests a symbol table listing.  High-level
  480. listings require that a compiler debugging option like `-g' be used,
  481. and that assembly listings (`-al') be requested also.
  482.  
  483.    Use the `-ad' option to omit debugging directives from the listing.
  484.  
  485.    Once you have specified one of these options, you can further control
  486. listing output and its appearance using the directives `.list',
  487. `.nolist', `.psize', `.eject', `.title', and `.sbttl'.  The `-an'
  488. option turns off all forms processing.  If you do not request listing
  489. output with one of the `-a' options, the listing-control directives
  490. have no effect.
  491.  
  492.    The letters after `-a' may be combined into one option, *e.g.*,
  493. `-aln'.
  494.  
  495. 
  496. File: as.info,  Node: D,  Next: f,  Prev: a,  Up: Invoking
  497.  
  498. `-D'
  499. ====
  500.  
  501.    This option has no effect whatsoever, but it is accepted to make it
  502. more likely that scripts written for other assemblers also work with
  503. `as'.
  504.  
  505. 
  506. File: as.info,  Node: f,  Next: I,  Prev: D,  Up: Invoking
  507.  
  508. Work Faster: `-f'
  509. =================
  510.  
  511.    `-f' should only be used when assembling programs written by a
  512. (trusted) compiler.  `-f' stops the assembler from doing whitespace and
  513. comment preprocessing on the input file(s) before assembling them.
  514. *Note Preprocessing: Preprocessing.
  515.  
  516.      *Warning:* if you use `-f' when the files actually need to be
  517.      preprocessed (if they contain comments, for example), `as' does
  518.      not work correctly.
  519.  
  520. 
  521. File: as.info,  Node: I,  Next: K,  Prev: f,  Up: Invoking
  522.  
  523. `.include' search path: `-I' PATH
  524. =================================
  525.  
  526.    Use this option to add a PATH to the list of directories `as'
  527. searches for files specified in `.include' directives (*note
  528. `.include': Include.).  You may use `-I' as many times as necessary to
  529. include a variety of paths.  The current working directory is always
  530. searched first; after that, `as' searches any `-I' directories in the
  531. same order as they were specified (left to right) on the command line.
  532.  
  533. 
  534. File: as.info,  Node: K,  Next: L,  Prev: I,  Up: Invoking
  535.  
  536. Difference Tables: `-K'
  537. =======================
  538.  
  539.    `as' sometimes alters the code emitted for directives of the form
  540. `.word SYM1-SYM2'; *note `.word': Word..  You can use the `-K' option
  541. if you want a warning issued when this is done.
  542.  
  543. 
  544. File: as.info,  Node: L,  Next: o,  Prev: K,  Up: Invoking
  545.  
  546. Include Local Labels: `-L'
  547. ==========================
  548.  
  549.    Labels beginning with `L' (upper case only) are called "local
  550. labels". *Note Symbol Names::.  Normally you do not see such labels when
  551. debugging, because they are intended for the use of programs (like
  552. compilers) that compose assembler programs, not for your notice.
  553. Normally both `as' and `ld' discard such labels, so you do not normally
  554. debug with them.
  555.  
  556.    This option tells `as' to retain those `L...' symbols in the object
  557. file.  Usually if you do this you also tell the linker `ld' to preserve
  558. symbols whose names begin with `L'.
  559.  
  560.    By default, a local label is any label beginning with `L', but each
  561. target is allowed to redefine the local label prefix.  On the HPPA
  562. local labels begin with `L$'.
  563.  
  564. 
  565. File: as.info,  Node: o,  Next: R,  Prev: L,  Up: Invoking
  566.  
  567. Name the Object File: `-o'
  568. ==========================
  569.  
  570.    There is always one object file output when you run `as'.  By
  571. default it has the name `a.out' (or `b.out', for Intel 960 targets
  572. only).  You use this option (which takes exactly one filename) to give
  573. the object file a different name.
  574.  
  575.    Whatever the object file is called, `as' overwrites any existing
  576. file of the same name.
  577.  
  578. 
  579. File: as.info,  Node: R,  Next: statistics,  Prev: o,  Up: Invoking
  580.  
  581. Join Data and Text Sections: `-R'
  582. =================================
  583.  
  584.    `-R' tells `as' to write the object file as if all data-section data
  585. lives in the text section.  This is only done at the very last moment:
  586. your binary data are the same, but data section parts are relocated
  587. differently.  The data section part of your object file is zero bytes
  588. long because all its bytes are appended to the text section.  (*Note
  589. Sections and Relocation: Sections.)
  590.  
  591.    When you specify `-R' it would be possible to generate shorter
  592. address displacements (because we do not have to cross between text and
  593. data section).  We refrain from doing this simply for compatibility with
  594. older versions of `as'.  In future, `-R' may work this way.
  595.  
  596.    When `as' is configured for COFF output, this option is only useful
  597. if you use sections named `.text' and `.data'.
  598.  
  599.    `-R' is not supported for any of the HPPA targets.  Using `-R'
  600. generates a warning from `as'.
  601.  
  602. 
  603. File: as.info,  Node: statistics,  Next: v,  Prev: R,  Up: Invoking
  604.  
  605. Display Assembly Statistics: `--statistics'
  606. ===========================================
  607.  
  608.    Use `--statistics' to display two statistics about the resources
  609. used by `as': the maximum amount of space allocated during the assembly
  610. (in bytes), and the total execution time taken for the assembly (in CPU
  611. seconds).
  612.  
  613. 
  614. File: as.info,  Node: v,  Next: W,  Prev: statistics,  Up: Invoking
  615.  
  616. Announce Version: `-v'
  617. ======================
  618.  
  619.    You can find out what version of as is running by including the
  620. option `-v' (which you can also spell as `-version') on the command
  621. line.
  622.  
  623. 
  624. File: as.info,  Node: W,  Next: Z,  Prev: v,  Up: Invoking
  625.  
  626. Suppress Warnings: `-W'
  627. =======================
  628.  
  629.    `as' should never give a warning or error message when assembling
  630. compiler output.  But programs written by people often cause `as' to
  631. give a warning that a particular assumption was made.  All such
  632. warnings are directed to the standard error file.  If you use this
  633. option, no warnings are issued.  This option only affects the warning
  634. messages: it does not change any particular of how `as' assembles your
  635. file.  Errors, which stop the assembly, are still reported.
  636.  
  637. 
  638. File: as.info,  Node: Z,  Prev: W,  Up: Invoking
  639.  
  640. Generate Object File in Spite of Errors: `-Z'
  641. =============================================
  642.  
  643.    After an error message, `as' normally produces no output.  If for
  644. some reason you are interested in object file output even after `as'
  645. gives an error message on your program, use the `-Z' option.  If there
  646. are any errors, `as' continues anyways, and writes an object file after
  647. a final warning message of the form `N errors, M warnings, generating
  648. bad object file.'
  649.  
  650. 
  651. File: as.info,  Node: Syntax,  Next: Sections,  Prev: Invoking,  Up: Top
  652.  
  653. Syntax
  654. ******
  655.  
  656.    This chapter describes the machine-independent syntax allowed in a
  657. source file.  `as' syntax is similar to what many other assemblers use;
  658. it is inspired by the BSD 4.2 assembler, except that `as' does not
  659. assemble Vax bit-fields.
  660.  
  661. * Menu:
  662.  
  663. * Preprocessing::              Preprocessing
  664. * Whitespace::                  Whitespace
  665. * Comments::                    Comments
  666. * Symbol Intro::                Symbols
  667. * Statements::                  Statements
  668. * Constants::                   Constants
  669.  
  670. 
  671. File: as.info,  Node: Preprocessing,  Next: Whitespace,  Up: Syntax
  672.  
  673. Preprocessing
  674. =============
  675.  
  676.    The `as' internal preprocessor:
  677.    * adjusts and removes extra whitespace.  It leaves one space or tab
  678.      before the keywords on a line, and turns any other whitespace on
  679.      the line into a single space.
  680.  
  681.    * removes all comments, replacing them with a single space, or an
  682.      appropriate number of newlines.
  683.  
  684.    * converts character constants into the appropriate numeric values.
  685.  
  686.    It does not do macro processing, include file handling, or anything
  687. else you may get from your C compiler's preprocessor.  You can do
  688. include file processing with the `.include' directive (*note
  689. `.include': Include.).  You can use the GNU C compiler driver to get
  690. other "CPP" style preprocessing, by giving the input file a `.S'
  691. suffix.  *Note Options Controlling the Kind of Output:
  692. (gcc.info)Overall Options.
  693.  
  694.    Excess whitespace, comments, and character constants cannot be used
  695. in the portions of the input text that are not preprocessed.
  696.  
  697.    If the first line of an input file is `#NO_APP' or if you use the
  698. `-f' option, whitespace and comments are not removed from the input
  699. file.  Within an input file, you can ask for whitespace and comment
  700. removal in specific portions of the by putting a line that says `#APP'
  701. before the text that may contain whitespace or comments, and putting a
  702. line that says `#NO_APP' after this text.  This feature is mainly
  703. intend to support `asm' statements in compilers whose output is
  704. otherwise free of comments and whitespace.
  705.  
  706. 
  707. File: as.info,  Node: Whitespace,  Next: Comments,  Prev: Preprocessing,  Up: Syntax
  708.  
  709. Whitespace
  710. ==========
  711.  
  712.    "Whitespace" is one or more blanks or tabs, in any order.
  713. Whitespace is used to separate symbols, and to make programs neater for
  714. people to read.  Unless within character constants (*note Character
  715. Constants: Characters.), any whitespace means the same as exactly one
  716. space.
  717.  
  718. 
  719. File: as.info,  Node: Comments,  Next: Symbol Intro,  Prev: Whitespace,  Up: Syntax
  720.  
  721. Comments
  722. ========
  723.  
  724.    There are two ways of rendering comments to `as'.  In both cases the
  725. comment is equivalent to one space.
  726.  
  727.    Anything from `/*' through the next `*/' is a comment.  This means
  728. you may not nest these comments.
  729.  
  730.      /*
  731.        The only way to include a newline ('\n') in a comment
  732.        is to use this sort of comment.
  733.      */
  734.      
  735.      /* This sort of comment does not nest. */
  736.  
  737.    Anything from the "line comment" character to the next newline is
  738. considered a comment and is ignored.  The line comment character is `#'
  739. on the Vax; `#' on the i960; `!' on the SPARC; `|' on the 680x0; `;'
  740. for the AMD 29K family; `;' for the H8/300 family; `!' for the H8/500
  741. family; `;' for the HPPA; `!' for the Hitachi SH; `!' for the Z8000;
  742. see *Note Machine Dependencies::.
  743.  
  744.    On some machines there are two different line comment characters.
  745. One character only begins a comment if it is the first non-whitespace
  746. character on a line, while the other always begins a comment.
  747.  
  748.    To be compatible with past assemblers, lines that begin with `#'
  749. have a special interpretation.  Following the `#' should be an absolute
  750. expression (*note Expressions::.): the logical line number of the *next*
  751. line.  Then a string (*note Strings: Strings.) is allowed: if present
  752. it is a new logical file name.  The rest of the line, if any, should be
  753. whitespace.
  754.  
  755.    If the first non-whitespace characters on the line are not numeric,
  756. the line is ignored.  (Just like a comment.)
  757.  
  758.                                # This is an ordinary comment.
  759.      # 42-6 "new_file_name"    # New logical file name
  760.                                # This is logical line # 36.
  761.    This feature is deprecated, and may disappear from future versions
  762. of `as'.
  763.  
  764. 
  765. File: as.info,  Node: Symbol Intro,  Next: Statements,  Prev: Comments,  Up: Syntax
  766.  
  767. Symbols
  768. =======
  769.  
  770.    A "symbol" is one or more characters chosen from the set of all
  771. letters (both upper and lower case), digits and the three characters
  772. `_.$'.  On most machines, you can also use `$' in symbol names;
  773. exceptions are noted in *Note Machine Dependencies::.  No symbol may
  774. begin with a digit.  Case is significant.  There is no length limit:
  775. all characters are significant.  Symbols are delimited by characters
  776. not in that set, or by the beginning of a file (since the source
  777. program must end with a newline, the end of a file is not a possible
  778. symbol delimiter).  *Note Symbols::.
  779.  
  780. 
  781. File: as.info,  Node: Statements,  Next: Constants,  Prev: Symbol Intro,  Up: Syntax
  782.  
  783. Statements
  784. ==========
  785.  
  786.    A "statement" ends at a newline character (`\n') or line separator
  787. character.  (The line separator is usually `;', unless this conflicts
  788. with the comment character; *note Machine Dependencies::..)  The
  789. newline or separator character is considered part of the preceding
  790. statement.  Newlines and separators within character constants are an
  791. exception: they do not end statements.
  792.  
  793.    It is an error to end any statement with end-of-file:  the last
  794. character of any input file should be a newline.
  795.  
  796.    You may write a statement on more than one line if you put a
  797. backslash (`\') immediately in front of any newlines within the
  798. statement.  When `as' reads a backslashed newline both characters are
  799. ignored.  You can even put backslashed newlines in the middle of symbol
  800. names without changing the meaning of your source program.
  801.  
  802.    An empty statement is allowed, and may include whitespace.  It is
  803. ignored.
  804.  
  805.    A statement begins with zero or more labels, optionally followed by a
  806. key symbol which determines what kind of statement it is.  The key
  807. symbol determines the syntax of the rest of the statement.  If the
  808. symbol begins with a dot `.' then the statement is an assembler
  809. directive: typically valid for any computer.  If the symbol begins with
  810. a letter the statement is an assembly language "instruction": it
  811. assembles into a machine language instruction.  Different versions of
  812. `as' for different computers recognize different instructions.  In
  813. fact, the same symbol may represent a different instruction in a
  814. different computer's assembly language.
  815.  
  816.    A label is a symbol immediately followed by a colon (`:').
  817. Whitespace before a label or after a colon is permitted, but you may not
  818. have whitespace between a label's symbol and its colon. *Note Labels::.
  819.  
  820.    For HPPA targets, labels need not be immediately followed by a
  821. colon, but the definition of a label must begin in column zero.  This
  822. also implies that only one label may be defined on each line.
  823.  
  824.      label:     .directive    followed by something
  825.      another_label:           # This is an empty statement.
  826.                 instruction   operand_1, operand_2, ...
  827.  
  828. 
  829. File: as.info,  Node: Constants,  Prev: Statements,  Up: Syntax
  830.  
  831. Constants
  832. =========
  833.  
  834.    A constant is a number, written so that its value is known by
  835. inspection, without knowing any context.  Like this:
  836.      .byte  74, 0112, 092, 0x4A, 0X4a, 'J, '\J # All the same value.
  837.      .ascii "Ring the bell\7"                  # A string constant.
  838.      .octa  0x123456789abcdef0123456789ABCDEF0 # A bignum.
  839.      .float 0f-314159265358979323846264338327\
  840.      95028841971.693993751E-40                 # - pi, a flonum.
  841.  
  842. * Menu:
  843.  
  844. * Characters::                  Character Constants
  845. * Numbers::                     Number Constants
  846.  
  847. 
  848. File: as.info,  Node: Characters,  Next: Numbers,  Up: Constants
  849.  
  850. Character Constants
  851. -------------------
  852.  
  853.    There are two kinds of character constants.  A "character" stands
  854. for one character in one byte and its value may be used in numeric
  855. expressions.  String constants (properly called string *literals*) are
  856. potentially many bytes and their values may not be used in arithmetic
  857. expressions.
  858.  
  859. * Menu:
  860.  
  861. * Strings::                     Strings
  862. * Chars::                       Characters
  863.  
  864. 
  865. File: as.info,  Node: Strings,  Next: Chars,  Up: Characters
  866.  
  867. Strings
  868. .......
  869.  
  870.    A "string" is written between double-quotes.  It may contain
  871. double-quotes or null characters.  The way to get special characters
  872. into a string is to "escape" these characters: precede them with a
  873. backslash `\' character.  For example `\\' represents one backslash:
  874. the first `\' is an escape which tells `as' to interpret the second
  875. character literally as a backslash (which prevents `as' from
  876. recognizing the second `\' as an escape character).  The complete list
  877. of escapes follows.
  878.  
  879. `\b'
  880.      Mnemonic for backspace; for ASCII this is octal code 010.
  881.  
  882. `\f'
  883.      Mnemonic for FormFeed; for ASCII this is octal code 014.
  884.  
  885. `\n'
  886.      Mnemonic for newline; for ASCII this is octal code 012.
  887.  
  888. `\r'
  889.      Mnemonic for carriage-Return; for ASCII this is octal code 015.
  890.  
  891. `\t'
  892.      Mnemonic for horizontal Tab; for ASCII this is octal code 011.
  893.  
  894. `\ DIGIT DIGIT DIGIT'
  895.      An octal character code.  The numeric code is 3 octal digits.  For
  896.      compatibility with other Unix systems, 8 and 9 are accepted as
  897.      digits: for example, `\008' has the value 010, and `\009' the
  898.      value 011.
  899.  
  900. `\`x' HEX-DIGIT HEX-DIGIT'
  901.      A hex character code.  The numeric code is 2 hexadecimal digits.
  902.      Either upper or lower case `x' works.
  903.  
  904. `\\'
  905.      Represents one `\' character.
  906.  
  907. `\"'
  908.      Represents one `"' character.  Needed in strings to represent this
  909.      character, because an unescaped `"' would end the string.
  910.  
  911. `\ ANYTHING-ELSE'
  912.      Any other character when escaped by `\' gives a warning, but
  913.      assembles as if the `\' was not present.  The idea is that if you
  914.      used an escape sequence you clearly didn't want the literal
  915.      interpretation of the following character.  However `as' has no
  916.      other interpretation, so `as' knows it is giving you the wrong
  917.      code and warns you of the fact.
  918.  
  919.    Which characters are escapable, and what those escapes represent,
  920. varies widely among assemblers.  The current set is what we think the
  921. BSD 4.2 assembler recognizes, and is a subset of what most C compilers
  922. recognize.  If you are in doubt, do not use an escape sequence.
  923.  
  924. 
  925. File: as.info,  Node: Chars,  Prev: Strings,  Up: Characters
  926.  
  927. Characters
  928. ..........
  929.  
  930.    A single character may be written as a single quote immediately
  931. followed by that character.  The same escapes apply to characters as to
  932. strings.  So if you want to write the character backslash, you must
  933. write `'\\' where the first `\' escapes the second `\'.  As you can
  934. see, the quote is an acute accent, not a grave accent.  A newline
  935. immediately following an acute accent is taken as a literal character
  936. and does not count as the end of a statement.  The value of a character
  937. constant in a numeric expression is the machine's byte-wide code for
  938. that character.  `as' assumes your character code is ASCII: `'A' means
  939. 65, `'B' means 66, and so on.
  940.  
  941. 
  942. File: as.info,  Node: Numbers,  Prev: Characters,  Up: Constants
  943.  
  944. Number Constants
  945. ----------------
  946.  
  947.    `as' distinguishes three kinds of numbers according to how they are
  948. stored in the target machine.  *Integers* are numbers that would fit
  949. into an `int' in the C language.  *Bignums* are integers, but they are
  950. stored in more than 32 bits.  *Flonums* are floating point numbers,
  951. described below.
  952.  
  953. * Menu:
  954.  
  955. * Integers::                    Integers
  956. * Bignums::                     Bignums
  957. * Flonums::                     Flonums
  958.  
  959. 
  960. File: as.info,  Node: Integers,  Next: Bignums,  Up: Numbers
  961.  
  962. Integers
  963. ........
  964.  
  965.    A binary integer is `0b' or `0B' followed by zero or more of the
  966. binary digits `01'.
  967.  
  968.    An octal integer is `0' followed by zero or more of the octal digits
  969. (`01234567').
  970.  
  971.    A decimal integer starts with a non-zero digit followed by zero or
  972. more digits (`0123456789').
  973.  
  974.    A hexadecimal integer is `0x' or `0X' followed by one or more
  975. hexadecimal digits chosen from `0123456789abcdefABCDEF'.
  976.  
  977.    Integers have the usual values.  To denote a negative integer, use
  978. the prefix operator `-' discussed under expressions (*note Prefix
  979. Operators: Prefix Ops.).
  980.  
  981. 
  982. File: as.info,  Node: Bignums,  Next: Flonums,  Prev: Integers,  Up: Numbers
  983.  
  984. Bignums
  985. .......
  986.  
  987.    A "bignum" has the same syntax and semantics as an integer except
  988. that the number (or its negative) takes more than 32 bits to represent
  989. in binary.  The distinction is made because in some places integers are
  990. permitted while bignums are not.
  991.  
  992. 
  993. File: as.info,  Node: Flonums,  Prev: Bignums,  Up: Numbers
  994.  
  995. Flonums
  996. .......
  997.  
  998.    A "flonum" represents a floating point number.  The translation is
  999. indirect: a decimal floating point number from the text is converted by
  1000. `as' to a generic binary floating point number of more than sufficient
  1001. precision.  This generic floating point number is converted to a
  1002. particular computer's floating point format (or formats) by a portion
  1003. of `as' specialized to that computer.
  1004.  
  1005.    A flonum is written by writing (in order)
  1006.    * The digit `0'.  (`0' is optional on the HPPA.)
  1007.  
  1008.    * A letter, to tell `as' the rest of the number is a flonum.  `e' is
  1009.      recommended.  Case is not important.
  1010.  
  1011.      On the H8/300, H8/500, Hitachi SH, and AMD 29K architectures, the
  1012.      letter must be one of the letters `DFPRSX' (in upper or lower
  1013.      case).
  1014.  
  1015.      On the Intel 960 architecture, the letter must be one of the
  1016.      letters `DFT' (in upper or lower case).
  1017.  
  1018.      On the HPPA architecture, the letter must be `E' (upper case only).
  1019.  
  1020.    * An optional sign: either `+' or `-'.
  1021.  
  1022.    * An optional "integer part": zero or more decimal digits.
  1023.  
  1024.    * An optional "fractional part": `.' followed by zero or more
  1025.      decimal digits.
  1026.  
  1027.    * An optional exponent, consisting of:
  1028.  
  1029.         * An `E' or `e'.
  1030.  
  1031.         * Optional sign: either `+' or `-'.
  1032.  
  1033.         * One or more decimal digits.
  1034.  
  1035.    At least one of the integer part or the fractional part must be
  1036. present.  The floating point number has the usual base-10 value.
  1037.  
  1038.    `as' does all processing using integers.  Flonums are computed
  1039. independently of any floating point hardware in the computer running
  1040. `as'.
  1041.  
  1042. 
  1043. File: as.info,  Node: Sections,  Next: Symbols,  Prev: Syntax,  Up: Top
  1044.  
  1045. Sections and Relocation
  1046. ***********************
  1047.  
  1048. * Menu:
  1049.  
  1050. * Secs Background::             Background
  1051. * Ld Sections::                 ld Sections
  1052. * As Sections::                 as Internal Sections
  1053. * Sub-Sections::                Sub-Sections
  1054. * bss::                         bss Section
  1055.  
  1056. 
  1057. File: as.info,  Node: Secs Background,  Next: Ld Sections,  Up: Sections
  1058.  
  1059. Background
  1060. ==========
  1061.  
  1062.    Roughly, a section is a range of addresses, with no gaps; all data
  1063. "in" those addresses is treated the same for some particular purpose.
  1064. For example there may be a "read only" section.
  1065.  
  1066.    The linker `ld' reads many object files (partial programs) and
  1067. combines their contents to form a runnable program.  When `as' emits an
  1068. object file, the partial program is assumed to start at address 0.
  1069. `ld' assigns the final addresses for the partial program, so that
  1070. different partial programs do not overlap.  This is actually an
  1071. oversimplification, but it suffices to explain how `as' uses sections.
  1072.  
  1073.    `ld' moves blocks of bytes of your program to their run-time
  1074. addresses.  These blocks slide to their run-time addresses as rigid
  1075. units; their length does not change and neither does the order of bytes
  1076. within them.  Such a rigid unit is called a *section*.  Assigning
  1077. run-time addresses to sections is called "relocation".  It includes the
  1078. task of adjusting mentions of object-file addresses so they refer to
  1079. the proper run-time addresses.  For the H8/300 and H8/500, and for the
  1080. Hitachi SH, `as' pads sections if needed to ensure they end on a word
  1081. (sixteen bit) boundary.
  1082.  
  1083.    An object file written by `as' has at least three sections, any of
  1084. which may be empty.  These are named "text", "data" and "bss" sections.
  1085.  
  1086.    When it generates COFF output, `as' can also generate whatever other
  1087. named sections you specify using the `.section' directive (*note
  1088. `.section': Section.).  If you do not use any directives that place
  1089. output in the `.text' or `.data' sections, these sections still exist,
  1090. but are empty.
  1091.  
  1092.    When `as' generates SOM or ELF output for the HPPA, `as' can also
  1093. generate whatever other named sections you specify using the `.space'
  1094. and `.subspace' directives.  See `HP9000 Series 800 Assembly Language
  1095. Reference Manual' (HP 92432-90001) for details on the `.space' and
  1096. `.subspace' assembler directives.
  1097.  
  1098.    Additionally, `as' uses different names for the standard text, data,
  1099. and bss sections when generating SOM output.  Program text is placed
  1100. into the `$CODE$' section, data into `$DATA$', and BSS into `$BSS$'.
  1101.  
  1102.    Within the object file, the text section starts at address `0', the
  1103. data section follows, and the bss section follows the data section.
  1104.  
  1105.    When generating either SOM or ELF output files on the HPPA, the text
  1106. section starts at address `0', the data section at address `0x4000000',
  1107. and the bss section follows the data section.
  1108.  
  1109.    To let `ld' know which data changes when the sections are relocated,
  1110. and how to change that data, `as' also writes to the object file
  1111. details of the relocation needed.  To perform relocation `ld' must
  1112. know, each time an address in the object file is mentioned:
  1113.    * Where in the object file is the beginning of this reference to an
  1114.      address?
  1115.  
  1116.    * How long (in bytes) is this reference?
  1117.  
  1118.    * Which section does the address refer to?  What is the numeric
  1119.      value of
  1120.           (ADDRESS) - (START-ADDRESS OF SECTION)?
  1121.  
  1122.    * Is the reference to an address "Program-Counter relative"?
  1123.  
  1124.    In fact, every address `as' ever uses is expressed as
  1125.      (SECTION) + (OFFSET INTO SECTION)
  1126.  
  1127. Further, most expressions `as' computes have this section-relative
  1128. nature.  (For some object formats, such as SOM for the HPPA, some
  1129. expressions are symbol-relative instead.)
  1130.  
  1131.    In this manual we use the notation {SECNAME N} to mean "offset N
  1132. into section SECNAME."
  1133.  
  1134.    Apart from text, data and bss sections you need to know about the
  1135. "absolute" section.  When `ld' mixes partial programs, addresses in the
  1136. absolute section remain unchanged.  For example, address `{absolute 0}'
  1137. is "relocated" to run-time address 0 by `ld'.  Although the linker
  1138. never arranges two partial programs' data sections with overlapping
  1139. addresses after linking, *by definition* their absolute sections must
  1140. overlap.  Address `{absolute 239}' in one part of a program is always
  1141. the same address when the program is running as address `{absolute
  1142. 239}' in any other part of the program.
  1143.  
  1144.    The idea of sections is extended to the "undefined" section.  Any
  1145. address whose section is unknown at assembly time is by definition
  1146. rendered {undefined U}--where U is filled in later.  Since numbers are
  1147. always defined, the only way to generate an undefined address is to
  1148. mention an undefined symbol.  A reference to a named common block would
  1149. be such a symbol: its value is unknown at assembly time so it has
  1150. section *undefined*.
  1151.  
  1152.    By analogy the word *section* is used to describe groups of sections
  1153. in the linked program.  `ld' puts all partial programs' text sections
  1154. in contiguous addresses in the linked program.  It is customary to
  1155. refer to the *text section* of a program, meaning all the addresses of
  1156. all partial programs' text sections.  Likewise for data and bss
  1157. sections.
  1158.  
  1159.    Some sections are manipulated by `ld'; others are invented for use
  1160. of `as' and have no meaning except during assembly.
  1161.  
  1162. 
  1163. File: as.info,  Node: Ld Sections,  Next: As Sections,  Prev: Secs Background,  Up: Sections
  1164.  
  1165. ld Sections
  1166. ===========
  1167.  
  1168.    `ld' deals with just four kinds of sections, summarized below.
  1169.  
  1170. *named sections*
  1171. *text section*
  1172. *data section*
  1173.      These sections hold your program.  `as' and `ld' treat them as
  1174.      separate but equal sections.  Anything you can say of one section
  1175.      is true another.  When the program is running, however, it is
  1176.      customary for the text section to be unalterable.  The text
  1177.      section is often shared among processes: it contains instructions,
  1178.      constants and the like.  The data section of a running program is
  1179.      usually alterable: for example, C variables would be stored in the
  1180.      data section.
  1181.  
  1182. *bss section*
  1183.      This section contains zeroed bytes when your program begins
  1184.      running.  It is used to hold unitialized variables or common
  1185.      storage.  The length of each partial program's bss section is
  1186.      important, but because it starts out containing zeroed bytes there
  1187.      is no need to store explicit zero bytes in the object file.  The
  1188.      bss section was invented to eliminate those explicit zeros from
  1189.      object files.
  1190.  
  1191. *absolute section*
  1192.      Address 0 of this section is always "relocated" to runtime address
  1193.      0.  This is useful if you want to refer to an address that `ld'
  1194.      must not change when relocating.  In this sense we speak of
  1195.      absolute addresses being "unrelocatable": they do not change
  1196.      during relocation.
  1197.  
  1198. *undefined section*
  1199.      This "section" is a catch-all for address references to objects
  1200.      not in the preceding sections.
  1201.  
  1202.    An idealized example of three relocatable sections follows.  The
  1203. example uses the traditional section names `.text' and `.data'.  Memory
  1204. addresses are on the horizontal axis.
  1205.  
  1206.                            +-----+----+--+
  1207.      partial program # 1:  |ttttt|dddd|00|
  1208.                            +-----+----+--+
  1209.      
  1210.                            text   data bss
  1211.                            seg.   seg. seg.
  1212.      
  1213.                            +---+---+---+
  1214.      partial program # 2:  |TTT|DDD|000|
  1215.                            +---+---+---+
  1216.      
  1217.                            +--+---+-----+--+----+---+-----+~~
  1218.      linked program:       |  |TTT|ttttt|  |dddd|DDD|00000|
  1219.                            +--+---+-----+--+----+---+-----+~~
  1220.      
  1221.          addresses:        0 ...
  1222.  
  1223. 
  1224. File: as.info,  Node: As Sections,  Next: Sub-Sections,  Prev: Ld Sections,  Up: Sections
  1225.  
  1226. as Internal Sections
  1227. ====================
  1228.  
  1229.    These sections are meant only for the internal use of `as'.  They
  1230. have no meaning at run-time.  You do not really need to know about these
  1231. sections for most purposes; but they can be mentioned in `as' warning
  1232. messages, so it might be helpful to have an idea of their meanings to
  1233. `as'.  These sections are used to permit the value of every expression
  1234. in your assembly language program to be a section-relative address.
  1235.  
  1236. ASSEMBLER-INTERNAL-LOGIC-ERROR!
  1237.      An internal assembler logic error has been found.  This means
  1238.      there is a bug in the assembler.
  1239.  
  1240. expr section
  1241.      The assembler stores complex expression internally as combinations
  1242.      of symbols.  When it needs to represent an expression as a symbol,
  1243.      it puts it in the expr section.
  1244.  
  1245. 
  1246. File: as.info,  Node: Sub-Sections,  Next: bss,  Prev: As Sections,  Up: Sections
  1247.  
  1248. Sub-Sections
  1249. ============
  1250.  
  1251.    Assembled bytes conventionally fall into two sections: text and data.
  1252. You may have separate groups of data in named sections that you want to
  1253. end up near to each other in the object file, even though they are not
  1254. contiguous in the assembler source.  `as' allows you to use
  1255. "subsections" for this purpose.  Within each section, there can be
  1256. numbered subsections with values from 0 to 8192.  Objects assembled
  1257. into the same subsection go into the object file together with other
  1258. objects in the same subsection.  For example, a compiler might want to
  1259. store constants in the text section, but might not want to have them
  1260. interspersed with the program being assembled.  In this case, the
  1261. compiler could issue a `.text 0' before each section of code being
  1262. output, and a `.text 1' before each group of constants being output.
  1263.  
  1264.    Subsections are optional.  If you do not use subsections, everything
  1265. goes in subsection number zero.
  1266.  
  1267.    Each subsection is zero-padded up to a multiple of four bytes.
  1268. (Subsections may be padded a different amount on different flavors of
  1269. `as'.)
  1270.  
  1271.    Subsections appear in your object file in numeric order, lowest
  1272. numbered to highest.  (All this to be compatible with other people's
  1273. assemblers.) The object file contains no representation of subsections;
  1274. `ld' and other programs that manipulate object files see no trace of
  1275. them.  They just see all your text subsections as a text section, and
  1276. all your data subsections as a data section.
  1277.  
  1278.    To specify which subsection you want subsequent statements assembled
  1279. into, use a numeric argument to specify it, in a `.text EXPRESSION' or
  1280. a `.data EXPRESSION' statement.  When generating COFF output, you can
  1281. also use an extra subsection argument with arbitrary named sections:
  1282. `.section NAME, EXPRESSION'.  EXPRESSION should be an absolute
  1283. expression.  (*Note Expressions::.)  If you just say `.text' then
  1284. `.text 0' is assumed.  Likewise `.data' means `.data 0'.  Assembly
  1285. begins in `text 0'.  For instance:
  1286.      .text 0     # The default subsection is text 0 anyway.
  1287.      .ascii "This lives in the first text subsection. *"
  1288.      .text 1
  1289.      .ascii "But this lives in the second text subsection."
  1290.      .data 0
  1291.      .ascii "This lives in the data section,"
  1292.      .ascii "in the first data subsection."
  1293.      .text 0
  1294.      .ascii "This lives in the first text section,"
  1295.      .ascii "immediately following the asterisk (*)."
  1296.  
  1297.    Each section has a "location counter" incremented by one for every
  1298. byte assembled into that section.  Because subsections are merely a
  1299. convenience restricted to `as' there is no concept of a subsection
  1300. location counter.  There is no way to directly manipulate a location
  1301. counter--but the `.align' directive changes it, and any label
  1302. definition captures its current value.  The location counter of the
  1303. section where statements are being assembled is said to be the "active"
  1304. location counter.
  1305.  
  1306. 
  1307. File: as.info,  Node: bss,  Prev: Sub-Sections,  Up: Sections
  1308.  
  1309. bss Section
  1310. ===========
  1311.  
  1312.    The bss section is used for local common variable storage.  You may
  1313. allocate address space in the bss section, but you may not dictate data
  1314. to load into it before your program executes.  When your program starts
  1315. running, all the contents of the bss section are zeroed bytes.
  1316.  
  1317.    Addresses in the bss section are allocated with special directives;
  1318. you may not assemble anything directly into the bss section.  Hence
  1319. there are no bss subsections. *Note `.comm': Comm, *note `.lcomm':
  1320. Lcomm..
  1321.  
  1322. 
  1323. File: as.info,  Node: Symbols,  Next: Expressions,  Prev: Sections,  Up: Top
  1324.  
  1325. Symbols
  1326. *******
  1327.  
  1328.    Symbols are a central concept: the programmer uses symbols to name
  1329. things, the linker uses symbols to link, and the debugger uses symbols
  1330. to debug.
  1331.  
  1332.      *Warning:* `as' does not place symbols in the object file in the
  1333.      same order they were declared.  This may break some debuggers.
  1334.  
  1335. * Menu:
  1336.  
  1337. * Labels::                      Labels
  1338. * Setting Symbols::             Giving Symbols Other Values
  1339. * Symbol Names::                Symbol Names
  1340. * Dot::                         The Special Dot Symbol
  1341. * Symbol Attributes::           Symbol Attributes
  1342.  
  1343.